import allure
import json

from selenium.webdriver.common.by import By

from utils.timer import sleep
from page_object.page_login import PageLogin
from page_element import el_login
from config_manager import ConfigManager

class AddressSearch(PageLogin):
    """代理地列表页面"""

    def page_click_address_btn(self):
        """点击代理地列表按钮"""
        self.base_click(el_login.address_click)
        # sleep()

    def page_input_address(self):
        """输入id"""
        self.base_input(el_login.address_id,'1')
        sleep()

    def page_click_search_btn(self):
        """点击搜索按钮"""
        self.base_click(el_login.address_btn)
        # sleep()

    def page_get_error_info(self):
        """获取异常提示信息"""
        return self.base_get_text(el_login.login_err_info)
    def page_submit(self):
        return self.base_click(el_login.address_commit)

    # 逻辑
    def page_address(self, username, password):

        self.page_login(username, password)
        sleep(3)
        self.page_click_address_btn()
        sleep(3)
        self.page_input_address()
        sleep(3)
        self.page_click_search_btn()
        sleep(3)
        self.page_get_error_info()
        sleep(3)
        self.page_submit()
